/*
测试Annotation的优先级
 */
import org.example.Arithmetic;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class testAnnotation {
    @BeforeAll
    public static void before1(){
        System.out.println("before1");
        System.out.println("--------");
    }
    @AfterAll
    public static void after1(){
        System.out.println("after1");
        System.out.println("--------");
    }
    @BeforeEach
    public void before2(){
        System.out.println("before2");
    }
    @AfterEach
    public void after2(){
        System.out.println("after2");
        System.out.println("-------");
    }
    @Test
    public void testAdd() {
        assertEquals(8,new Arithmetic(3,5).add());
        System.out.println("testAdd");
    }

    @Test
    public void testSubtract() {
        assertEquals(-2,new Arithmetic(3,5).subtract());
        System.out.println("testSubtract");
    }

    @Test
    public void testMultiply() {
        assertEquals(15,new Arithmetic(3,5).multiply());
        System.out.println("testMultiply");
    }

    @Test
    public void testDivide() {
        assertEquals(2,new Arithmetic(8,4).divide());
        System.out.println("testDivide");
    }
}
